package com.study.designmodel.abstractfactory;

import com.study.designmodel.factory.Shape;

/**
 * @description: AbstrarctFactoryModel
 * @date: 2021/2/4 11:20
 * @author: hcm
 * @version: 1.0
 */
public class AbstrarctFactoryModel {
    public static void main(String[] args) {
        //工厂选择器
        AbstractFactory shapeFactory = FactoryProducer.getFactory("shape");
        com.study.designmodel.factory.Shape c = shapeFactory.getShape("c");
        c.draw();
        com.study.designmodel.factory.Shape r = shapeFactory.getShape("r");
        r.draw();
        Shape s = shapeFactory.getShape("s");
        s.draw();

        //获取颜色工厂
        AbstractFactory colorFactory = FactoryProducer.getFactory("color");
        Color r1 = colorFactory.getColor("r");
        r1.fill();
        Color g = colorFactory.getColor("g");
        g.fill();
        Color y = colorFactory.getColor("y");
        y.fill();


    }
}
